package com.tecsoluction.transportecerto;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Toast;

public class MenuPrincipal  extends Activity implements OnClickListener, LocationListener{

//	private MapView mapa;
//	private MapController controleMapa;
//	double latitude, longitude;  
//	private MyLocationOverlay minhaLocalizacao=null; 
//	private Location localizacao=null;
		
	ImageButton botao1;
	ImageButton botao2;
	ImageButton botao3;
	ImageButton botao4;
	ImageButton botao5;
	ImageButton botao6;
	ImageButton botao7;
	ImageButton botao8;
	ImageButton botao9;

	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
	
			setContentView(R.layout.menu_principal);

//			mapa = (MapView) findViewById(R.id.mapView);
//			controleMapa = mapa.getController();
//
//			//    	Latitudes da Faculdade Mauricio de Nassau   
//			latitude = -8.217978;
//			longitude = -34.931033;
//      
//			minhaLocalizacao = new MyLocationOverlay(this, mapa);
//	        mapa.getOverlays().add(minhaLocalizacao);
//	        localizacao = retornaLocationManager().getLastKnownLocation(LocationManager.GPS_PROVIDER);
//			
//	        if (localizacao != null)
//			{
//				Log.i("onLocationChanged","Lat: "+localizacao.getLatitude()+"Lon:"+localizacao.getLongitude());
//			Toast.makeText(getBaseContext(), "Lat: "+localizacao.getLatitude()+"Lon:"+localizacao.getLongitude(), Toast.LENGTH_LONG).show();
//				GeoPoint gp = posicao(localizacao.getLatitude(),localizacao.getLongitude());
//				controleMapa.setCenter(gp);
//			}
//	    		

//	        retornaLocationManager().requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
//
//	   	 
//			controleMapa.animateTo(posicao(latitude,longitude));
//			LocalOverlay localinicial= new LocalOverlay(posicao(latitude,longitude),R.drawable.icone_apontador);
//			mapa.getOverlays().add(localinicial);
//			mapa.setSatellite(false);
//			mapa.displayZoomControls(true); 
//			mapa.setClickable(true);
//			mapa.setBuiltInZoomControls(true);
//			LinearLayout linearZoonMapa = (LinearLayout) findViewById(R.id.zoonMapaPrincipal);
//			linearZoonMapa.addView(mapa.getZoomControls());
//			controleMapa.setZoom(18);
//			mapa.invalidate();

		
	botao1 = (ImageButton)findViewById(R.id.bt_destino);
	botao2 = (ImageButton)findViewById(R.id.bt_lsParadas);
	
	botao3 = (ImageButton)findViewById(R.id.bt_redesocial);
	botao4 = (ImageButton)findViewById(R.id.bt_config);
	
	botao5 = (ImageButton)findViewById(R.id.bt_info);
	botao6 = (ImageButton)findViewById(R.id.bt_off);
//					
//	botao7 = (ImageButton)findViewById(R.id.bt_back);
//	botao8 = (ImageButton)findViewById(R.id.bt_volume);
	
//	botao9 = (ImageButton)findViewById(R.id.bt_comunicarstatus);
	
	}
	
	
	
	
	public void onClick(View v) {
//	if(v==botao1)
//	{
//		Intent intent = new Intent(getBaseContext(),EscolherDestino.class);
//		startActivity(intent);
//		finish();
//	
//	}
	
		// implementar outros eventos
	
		 if(v==botao2)
		{
			Intent intent = new Intent(getBaseContext(),MapaParadas.class);
			startActivity(intent);
			finish();
		}
		else if(v==botao3)
		{
			Intent intent = new Intent(getBaseContext(),MenuRedeSocial.class);
			startActivity(intent);
			finish();
		}
//		else if(v==botao4)
//		{
//			Intent intent = new Intent(getBaseContext(),Configuracao.class);
//			startActivity(intent);
//			finish();
//		}
		else if(v==botao5)
		{
Toast.makeText(getBaseContext(), "TransporteCerto Version 1.0.1",Toast.LENGTH_LONG).show();
		}
		else if(v==botao6)
		{
		Toast.makeText(getBaseContext(), "Desligando App", Toast.LENGTH_SHORT).show();
		finish();
		}
		
	}
	public GeoPoint posicao(double latitude ,double longetude)
	{
		GeoPoint geopoint = new GeoPoint((int)(latitude *1E6), (int)(longetude* 1E6));


		return geopoint;
	}




	
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}




	public void onLocationChanged(Location location) {
//		Log.i("onLocationChanged", "Lat: "+location.getLatitude()+"Lon: "+location.getLongitude());
//		GeoPoint gp = posicao(location.getLatitude(),location.getLongitude());
//		controleMapa.setCenter(gp);
	}




	public void onProviderDisabled(String provider) {
		// TODO Auto-generated method stub
		
	}




	public void onProviderEnabled(String provider) {
		// TODO Auto-generated method stub
		
	}




	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub
		
	}

	    

}


